package in.hitmedia.test.bitswise;

public class Bitwise 
{

	public static void main(String args[])
	{
		int a = 78      ;
		int b = 0x5;
		
		System.out.println(a);
		print (a);
		print2 (a);
		
		System.out.println(powerOf2(127));
		
	}
	
	public static boolean powerOf2(int l)
	{
		if ((l & (l-1)) == 0)
		{
			return true; 
		}
		return false;
	}
	
	static void print(int n)
	{
		for (int i = 31; i >=0 ; --i)
		{
			System.out.print(n >> i & 1 );
		}
		System.out.println();
	}
	
	static void print2(int n)
	{
		for (; n > 0 ; n >>= 1)
		{
			System.out.print(n & 1 );
		}
		System.out.println();
	}
	
}
